<% layout('/layouts/default.html', {title: '设备管理', libs: ['validate','fileupload']}){ %>
<div class="main-content">
	<div class="box box-main">
		<div class="box-header with-border">
			<div class="box-title">
				<i class="fa fa-list-alt"></i> ${text(equipInfo.isNewRecord ? '新增设备' : '编辑设备')}
			</div>
			<div class="box-tools pull-right">
				<button type="button" class="btn btn-box-tool" data-widget="collapse"><i class="fa fa-minus"></i></button>
			</div>
		</div>
		<#form:form id="inputForm" model="${equipInfo}" action="${ctx}/test/equipInfo/save" method="post" class="form-horizontal">
			<div class="box-body">
				<div class="form-unit">${text('设备基本信息')}</div>
				<#form:hidden path="id"/>
				<div class="row">
					<div class="col-xs-6">
						<div class="form-group">
							<label class="control-label col-sm-4" title="">
								<span class="required hide">*</span> ${text('设备编号')}：<i class="fa icon-question hide"></i></label>
							<div class="col-sm-8">
								<#form:input path="equipId" maxlength="64" class="form-control"/>
							</div>
						</div>
					</div>

					<div class="col-xs-6">
						<div class="form-group">
							<label class="control-label col-sm-4" title="">
								<span class="required hide">*</span> ${text('设备名称')}：<i class="fa icon-question hide"></i></label>
							<div class="col-sm-8">
								<#form:input path="equipName" maxlength="255" class="form-control"/>
							</div>
						</div>
					</div>

					 <#form:input:hidden  path="equipManagerCode" maxlength="64" class="form-control"/>
					 <#form:input:hidden  path="equipManager" maxlength="255" class="form-control"/>

				</div>

				<div class="row">
					<div class="col-xs-6">
						<div class="form-group">
							<label class="control-label col-sm-4" title="">
								<span class="required hide">*</span> ${text('设备类型')}：<i class="fa icon-question hide"></i></label>
							<div class="col-sm-8">
								<#form:input path="equipType" maxlength="255" class="form-control"/>
							</div>
						</div>
					</div>
					<div class="col-xs-6">
						<div class="form-group">
							<label class="control-label col-sm-4" title="">
								<span class="required hide">*</span> ${text('设备型号')}：<i class="fa icon-question hide"></i></label>
							<div class="col-sm-8">
								<#form:input path="equipModel" maxlength="255" class="form-control"/>
							</div>
						</div>
					</div>
				</div>
				<div class="row">
					<div class="col-xs-6">
						<div class="form-group">
							<label class="control-label col-sm-4" title="">
								<span class="required hide">*</span> ${text('生产厂商')}：<i class="fa icon-question hide"></i></label>
							<div class="col-sm-8">
								<#form:input path="manufacture" maxlength="255" class="form-control"/>
							</div>
						</div>
					</div>
					<div class="col-xs-6">
						<div class="form-group">
							<label class="control-label col-sm-4" title="">
								<span class="required hide">*</span> ${text('设备价格')}：<i class="fa icon-question hide"></i></label>
							<div class="col-sm-8">
								<#form:input path="equipPrice" class="form-control number"/>
							</div>
						</div>
					</div>
				</div>
				<div class="row">
					<div class="col-xs-6">
						<div class="form-group">
							<label class="control-label col-sm-4" title="">
								<span class="required hide">*</span> ${text('安放地点')}：<i class="fa icon-question hide"></i></label>
							<div class="col-sm-8">
								<#form:input path="equipPosition" maxlength="255" class="form-control"/>
							</div>
						</div>
					</div>
					<div class="col-xs-6">
						<div class="form-group">
							<label class="control-label col-sm-4" title="">
								<span class="required hide">*</span> ${text('购置时间')}：<i class="fa icon-question hide"></i></label>
							<div class="col-sm-8">
								<#form:input path="buyTime" readonly="true" maxlength="20" class="form-control Wdate"
								dataFormat="datetime" onclick="WdatePicker({dateFmt:'yyyy-MM-dd HH:mm',isShowClear:false});"/>
							</div>
						</div>
					</div>
					<#form:input:hidden path="deptId" maxlength="255" class="form-control required"/>
					<#form:input:hidden  path="equipStatus" maxlength="1" class="form-control"/>
				</div>

				<div class="row">
					<div class="col-xs-6">
						<div class="form-group">
							<label class="control-label col-sm-4" title="">
								<span class="required hide">*</span> ${text('使用年限')}：<i class="fa icon-question hide"></i></label>
							<div class="col-sm-8">
								<#form:input path="equipLife" maxlength="255" class="form-control"/>
							</div>
						</div>
					</div>

					<!--<div class="col-xs-6">-->
						<!--<div class="form-group">-->
							<!--<label class="control-label col-sm-4" title="">-->
								<!--<span class="required hide">*</span> ${text('点检计划编号')}：<i class="fa icon-question hide"></i></label>-->
							<!--<div class="col-sm-8">-->
								<!--<#form:input path="checkPlanCode" maxlength="64" class="form-control"/>-->
							<!--</div>-->
						<!--</div>-->
					<!--</div>-->
				</div>

				<!--<div class="row">-->
					<!--<div class="col-xs-6">-->
						<!--<div class="form-group">-->
							<!--<label class="control-label col-sm-4" title="">-->
								<!--<span class="required hide">*</span> ${text('巡检计划编号')}：<i class="fa icon-question hide"></i></label>-->
							<!--<div class="col-sm-8">-->
								<!--<#form:input path="inspectPlanCode" maxlength="64" class="form-control"/>-->
							<!--</div>-->
						<!--</div>-->
					<!--</div>-->
				<!--</div>-->
				<div class="row">
					<div class="col-xs-12">
						<div class="form-group">
							<label class="control-label col-sm-2" title="">
								<span class="required hide">*</span> ${text('备注')}：<i class="fa icon-question hide"></i></label>
							<div class="col-sm-10">
								<#form:textarea path="remarks" rows="4" maxlength="255" class="form-control"/>
							</div>
						</div>
					</div>
				</div>
				<div class="row">
					<div class="col-xs-6">
						<div class="form-group">
							<label class="control-label col-sm-4" title=""  hidden="hidden" >
								<span class="required hide">*</span> ${text('删除标记')}：<i class="fa icon-question hide"></i></label>
							<div class="col-sm-8">
								<#form:input:hidden  path="delFlag" maxlength="1" class="form-control"/>
							</div>
						</div>
					</div>
				</div>
				<div class="row">
					<div class="col-xs-12">
						<div class="form-group">
							<label class="control-label col-sm-2">${text('图片上传')}：</label>
							<div class="col-sm-10">
								<#form:fileupload id="uploadImage" bizKey="${equipInfo.id}" bizType="equipInfo_image"
									uploadType="image" class="" readonly="false"/>
							</div>
						</div>
					</div>
				</div>
				<div class="row">
					<div class="col-xs-12">
						<div class="form-group">
							<label class="control-label col-sm-2">${text('附件上传')}：</label>
							<div class="col-sm-10">
								<#form:fileupload id="uploadFile" bizKey="${equipInfo.id}" bizType="equipInfo_file"
									uploadType="all" class="" readonly="false"/>
							</div>
						</div>
					</div>
				</div>
			</div>
			<div class="box-footer">
				<div class="row">
					<div class="col-sm-offset-2 col-sm-10">
						<% if (hasPermi('test:equipInfo:edit')){ %>
							<button type="submit" class="btn btn-sm btn-primary" id="btnSubmit"><i class="fa fa-check"></i> ${text('保 存')}</button>&nbsp;
						<% } %>
						<button type="button" class="btn btn-sm btn-default" id="btnCancel" onclick="js.closeCurrentTabPage()"><i class="fa fa-reply-all"></i> ${text('关 闭')}</button>
					</div>
				</div>
			</div>
		</#form:form>
	</div>
</div>
<% } %>
<script>
$("#inputForm").validate({
	submitHandler: function(form){
		js.ajaxSubmitForm($(form), function(data){
			js.showMessage(data.message);
			if(data.result == Global.TRUE){
				js.closeCurrentTabPage(function(contentWindow){
					contentWindow.page();
				});
			}
		}, "json");
    }
});

//获取url参数
(function ($) {
    $.getUrlParam = function (name) {
        var reg = new RegExp("(^|&)" + name + "=([^&]*)(&|$)");
        var r = window.location.search.substr(1).match(reg);
        if (r != null) return decodeURIComponent(r[2]); return null;
    }
})(jQuery);

$(function () {//设备状态为报修、调拨、报废时只能查看不能编辑
    if($.getUrlParam("opera") == "view"){
        $("#equipId").attr("readonly", "readonly");
        $("#equipManager").attr("readonly", "readonly");
        $("#equipName").attr("readonly", "readonly");
        $("#equipType").attr("readonly", "readonly");
        $("#equipModel").attr("readonly","readonly");
        $("#manufacture").attr("readonly", "readonly");
        $("#equipPrice").attr("readonly", "readonly");
        $("#equipPosition").attr("readonly", "readonly");
        $("#deptId").attr("readonly", "readonly");
        $("#equipStatus").attr("readonly", "readonly");
        $("#buyTime").attr("disabled",true);
        $("#equipLife").attr("readonly", "readonly");
        // $('#uploadImage').attr("readonly", "readonly");
        // $('#uploadFile').attr("readonly", "readonly");
        $(".webuploader-element-invisible").attr("disabled",true);
        $('#btnSubmit').hide();//隐藏提交按钮
        // $('#back').show();
    }
});
</script>